﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using AirCondition.Data;

namespace AirCondition.HR
{
    public partial class AddProject : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string sql = "INSERT INTO [tb_PprojectInfo] ([pname], [pplace], [pmanager], [pstarttime], [pendtime], [pfunds], [paddmoney1], [paddmoney2], [paddmoney3], [paddmoney4], [paddmoney5] ,[pstatus]) VALUES (@pname, @pplace, @pmanager, @pstarttime, @pendtime, @pfunds, @paddmoney1, @paddmoney2, @paddmoney3, @paddmoney4, @paddmoney5, @pstatus)";
            SqlParameter[] sqlPara = { new SqlParameter("@pname", SqlDbType.NVarChar),
                                       new SqlParameter("@pplace", SqlDbType.NVarChar), 
                                       new SqlParameter("@pmanager", SqlDbType.NVarChar), 
                                       new SqlParameter("@pstarttime", SqlDbType.NVarChar),   
                                       new SqlParameter("@pendtime", SqlDbType.VarChar),
                                       new SqlParameter("@pfunds", SqlDbType.VarChar), 
                                       new SqlParameter("@paddmoney1", SqlDbType.VarChar),
                                       new SqlParameter("@paddmoney2", SqlDbType.VarChar), 
                                       new SqlParameter("@paddmoney3", SqlDbType.VarChar), 
                                       new SqlParameter("@paddmoney4", SqlDbType.VarChar),
                                       new SqlParameter("@paddmoney5", SqlDbType.VarChar),
                                       new SqlParameter("@pstatus", SqlDbType.NVarChar) 
                       
                                     };
            sqlPara[0].Value = TextBox1.Text.Trim();
            sqlPara[1].Value = TextBox2.Text.Trim();
            sqlPara[2].Value = TextBox3.Text.Trim();
            sqlPara[3].Value = TextBox4.Text.Trim();
            sqlPara[4].Value = TextBox5.Text.Trim();
            sqlPara[5].Value = TextBox6.Text.Trim();
            sqlPara[6].Value = TextBox7.Text.Trim();
            sqlPara[7].Value = TextBox8.Text.Trim();
            sqlPara[8].Value = TextBox9.Text.Trim();
            sqlPara[9].Value = TextBox10.Text.Trim();
            sqlPara[10].Value = TextBox11.Text.Trim();
            sqlPara[11].Value = DropDownList1.SelectedItem.Text.Trim();    



            int rows = new SQLHelp().ExecuteNonQuery(sql, sqlPara, ConfigurationManager.AppSettings["SQLServer"]);
            //int rows = ExecuteNonQuery(sql, sqlPara, ConfigurationManager.AppSettings["SQLExpress"]);

            Response.Write("<script language='javascript'>alert('添加成功');</script>");
        }
    }
}
